using System;
using System.Threading.Tasks;
using SheLife.Domain.Entities;

namespace SheLife.Domain.Interfaces.Repositories
{
    /// <summary>
    /// 系统用户角色仓储接口
    /// </summary>
    public interface ISystemUserRoleRepository : IRepository<SystemUserRole>
    {
        /// <summary>
        /// 根据用户ID获取用户角色列表
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>用户角色列表</returns>
        Task<IEnumerable<SystemUserRole>> GetByUserIdAsync(Guid userId);

        /// <summary>
        /// 根据角色ID获取用户角色列表
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <returns>用户角色列表</returns>
        Task<IEnumerable<SystemUserRole>> GetByRoleIdAsync(Guid roleId);

        /// <summary>
        /// 根据用户ID和角色ID获取用户角色
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="roleId">角色ID</param>
        /// <returns>用户角色</returns>
        Task<SystemUserRole> GetByUserIdAndRoleIdAsync(Guid userId, Guid roleId);

        /// <summary>
        /// 检查用户是否拥有指定角色
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="roleCode">角色编码</param>
        /// <returns>是否拥有角色</returns>
        Task<bool> CheckUserHasRoleAsync(Guid userId, string roleCode);

        /// <summary>
        /// 获取用户的角色列表
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>角色列表</returns>
        Task<IEnumerable<SystemRole>> GetUserRolesAsync(Guid userId);

        /// <summary>
        /// 批量为用户分配角色
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="roleIds">角色ID列表</param>
        /// <returns>执行结果</returns>
        Task<bool> AssignRolesToUserAsync(Guid userId, IEnumerable<Guid> roleIds);

        /// <summary>
        /// 批量移除用户的角色
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="roleIds">角色ID列表</param>
        /// <returns>执行结果</returns>
        Task<bool> RemoveRolesFromUserAsync(Guid userId, IEnumerable<Guid> roleIds);
    }
}